(N/A) The magnetic field of a point dipole $\vec{M} = M\hat{k}$ at a position $\vec{r}$ is given by $\vec{B}(\vec{r}) = \frac{\mu_0}{4\pi} \left[ \frac{3(\vec{M} \cdot \hat{r})\hat{r} - \vec{M}}{r^3} \right]$.
In the $x-z$ plane,$\vec{r} = x\hat{i} + z\hat{k} = r(\sin\theta\hat{i} + \cos\theta\hat{k})$,where $\theta$ is the angle with the $z$-axis. Then $\hat{r} = \sin\theta\hat{i} + \cos\theta\hat{k}$ and $\vec{M} \cdot \hat{r} = M\cos\theta$.
Thus,$\vec{B} = \frac{\mu_0 M}{4\pi r^3} [3\cos\theta(\sin\theta\hat{i} + \cos\theta\hat{k}) - \hat{k}] = \frac{\mu_0 M}{4\pi r^3} [3\sin\theta\cos\theta\hat{i} + (3\cos^2\theta - 1)\hat{k}]$.
Ampere's law states $\oint_C \vec{B} \cdot d\vec{l} = \mu_0 I_{enclosed}$. For a point dipole,there is no enclosed current,so $\oint_C \vec{B} \cdot d\vec{l} = 0$.
Along the arc of radius $a$,$d\vec{l} = a d\theta \hat{\phi} = a d\theta (-\cos\theta\hat{i} + \sin\theta\hat{k})$.
$\vec{B} \cdot d\vec{l} = \frac{\mu_0 M}{4\pi a^3} [3\sin\theta\cos\theta(-\cos\theta) + (3\cos^2\theta - 1)\sin\theta] a d\theta = \frac{\mu_0 M}{4\pi a^2} [-3\sin\theta\cos^2\theta + 3\sin\theta\cos^2\theta - \sin\theta] d\theta = -\frac{\mu_0 M}{4\pi a^2} \sin\theta d\theta$.
Integrating from $\theta = 0$ to $\pi/2$: $\int_0^{\pi/2} -\frac{\mu_0 M}{4\pi a^2} \sin\theta d\theta = -\frac{\mu_0 M}{4\pi a^2} [-\cos\theta]_0^{\pi/2} = -\frac{\mu_0 M}{4\pi a^2}$.
Along the $x$-axis $(z=0, \theta=\pi/2)$,$\vec{B} = \frac{\mu_0 M}{4\pi x^3} [3(1)(0)\hat{i} + (0-1)\hat{k}] = -\frac{\mu_0 M}{4\pi x^3} \hat{k}$. Since $d\vec{l} = dx \hat{i}$,$\vec{B} \cdot d\vec{l} = 0$.
Along the $z$-axis $(x=0, \theta=0)$,$\vec{B} = \frac{\mu_0 M}{4\pi z^3} [0 + (3-1)\hat{k}] = \frac{2\mu_0 M}{4\pi z^3} \hat{k}$. Since $d\vec{l} = dz \hat{k}$,$\vec{B} \cdot d\vec{l} = \frac{2\mu_0 M}{4\pi z^3} dz$.
Integrating from $z=a$ to $0$: $\int_a^0 \frac{2\mu_0 M}{4\pi z^3} dz = \frac{2\mu_0 M}{4\pi} [-\frac{1}{2z^2}]_a^0$. This integral diverges at the origin,confirming that Ampere's law is valid for the field of a dipole,but the path must not pass through the singularity at the origin.